Optimal. Leaf size=131 \[ -\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}+\frac {3 (-B+i A) \cot (c+d x)}{2 a d}-\frac {(2 A+i B) \log (\sin (c+d x))}{a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {3 x (-B+i A)}{2 a} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.21, antiderivative size = 131, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {3596, 3529, 3531, 3475} \[ -\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}+\frac {3 (-B+i A) \cot (c+d x)}{2 a d}-\frac {(2 A+i B) \log (\sin (c+d x))}{a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {3 x (-B+i A)}{2 a} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3529
Rule 3531
Rule 3596
Rubi steps
\begin {align*} \int \frac {\cot ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx &=\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \cot ^3(c+d x) (2 a (2 A+i B)-3 a (i A-B) \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \cot ^2(c+d x) (-3 a (i A-B)-2 a (2 A+i B) \tan (c+d x)) \, dx}{2 a^2}\\ &=\frac {3 (i A-B) \cot (c+d x)}{2 a d}-\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \cot (c+d x) (-2 a (2 A+i B)+3 a (i A-B) \tan (c+d x)) \, dx}{2 a^2}\\ &=\frac {3 (i A-B) x}{2 a}+\frac {3 (i A-B) \cot (c+d x)}{2 a d}-\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {(2 A+i B) \int \cot (c+d x) \, dx}{a}\\ &=\frac {3 (i A-B) x}{2 a}+\frac {3 (i A-B) \cot (c+d x)}{2 a d}-\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}-\frac {(2 A+i B) \log (\sin (c+d x))}{a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 7.47, size = 902, normalized size = 6.89 \[ \frac {\left (-\frac {1}{2} A \cos (c)-\frac {1}{2} i A \sin (c)\right ) (\cos (d x)+i \sin (d x)) (A+B \tan (c+d x)) \csc ^2(c+d x)}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)}+\frac {\csc \left (\frac {c}{2}\right ) \sec \left (\frac {c}{2}\right ) (\cos (d x)+i \sin (d x)) \left (\frac {1}{2} A \cos (c-d x)+\frac {1}{2} i B \cos (c-d x)-\frac {1}{2} A \cos (c+d x)-\frac {1}{2} i B \cos (c+d x)+\frac {1}{2} i A \sin (c-d x)-\frac {1}{2} B \sin (c-d x)-\frac {1}{2} i A \sin (c+d x)+\frac {1}{2} B \sin (c+d x)\right ) (A+B \tan (c+d x)) \csc (c+d x)}{2 d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)}+\frac {\left (2 A \cos \left (\frac {c}{2}\right )+i B \cos \left (\frac {c}{2}\right )+2 i A \sin \left (\frac {c}{2}\right )-B \sin \left (\frac {c}{2}\right )\right ) \left (i \tan ^{-1}(\tan (d x)) \cos \left (\frac {c}{2}\right )-\tan ^{-1}(\tan (d x)) \sin \left (\frac {c}{2}\right )\right ) (\cos (d x)+i \sin (d x)) (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)}+\frac {\left (2 A \cos \left (\frac {c}{2}\right )+i B \cos \left (\frac {c}{2}\right )+2 i A \sin \left (\frac {c}{2}\right )-B \sin \left (\frac {c}{2}\right )\right ) \left (-\frac {1}{2} \cos \left (\frac {c}{2}\right ) \log \left (\sin ^2(c+d x)\right )-\frac {1}{2} i \sin \left (\frac {c}{2}\right ) \log \left (\sin ^2(c+d x)\right )\right ) (\cos (d x)+i \sin (d x)) (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)}+\frac {x (2 A \csc (c)+i B \csc (c)+(2 A+i B) \cot (c) (-\cos (c)-i \sin (c))) (\cos (d x)+i \sin (d x)) (A+B \tan (c+d x))}{(A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)}+\frac {(A+i B) \cos (2 d x) \left (\frac {1}{4} i \sin (c)-\frac {\cos (c)}{4}\right ) (\cos (d x)+i \sin (d x)) (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)}+\frac {(A+i B) \left (\frac {3}{2} i d x \cos (c)-\frac {3}{2} d x \sin (c)\right ) (\cos (d x)+i \sin (d x)) (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)}+\frac {(A+i B) \left (\frac {1}{4} i \cos (c)+\frac {\sin (c)}{4}\right ) (\cos (d x)+i \sin (d x)) \sin (2 d x) (A+B \tan (c+d x))}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.62, size = 189, normalized size = 1.44 \[ \frac {{\left (14 i \, A - 10 \, B\right )} d x e^{\left (6 i \, d x + 6 i \, c\right )} + {\left ({\left (-28 i \, A + 20 \, B\right )} d x - A - 9 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left ({\left (14 i \, A - 10 \, B\right )} d x + 10 \, A + 10 i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} - 4 \, {\left ({\left (2 \, A + i \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} - 2 \, {\left (2 \, A + i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (2 \, A + i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right ) - A - i \, B}{4 \, {\left (a d e^{\left (6 i \, d x + 6 i \, c\right )} - 2 \, a d e^{\left (4 i \, d x + 4 i \, c\right )} + a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.95, size = 165, normalized size = 1.26 \[ -\frac {\frac {4 \, {\left (2 \, A + i \, B\right )} \log \left (-i \, \tan \left (d x + c\right )\right )}{a} - \frac {{\left (7 \, A + 5 i \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a} - \frac {{\left (A - i \, B\right )} \log \left (-i \, \tan \left (d x + c\right ) + 1\right )}{a} + \frac {7 \, A \tan \left (d x + c\right ) + 5 i \, B \tan \left (d x + c\right ) - 9 i \, A + 7 \, B}{a {\left (\tan \left (d x + c\right ) - i\right )}} - \frac {2 \, {\left (6 \, A \tan \left (d x + c\right )^{2} + 3 i \, B \tan \left (d x + c\right )^{2} + 2 i \, A \tan \left (d x + c\right ) - 2 \, B \tan \left (d x + c\right ) - A\right )}}{a \tan \left (d x + c\right )^{2}}}{4 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.72, size = 206, normalized size = 1.57 \[ \frac {A \ln \left (\tan \left (d x +c \right )+i\right )}{4 d a}-\frac {i B \ln \left (\tan \left (d x +c \right )+i\right )}{4 d a}-\frac {A}{2 a d \tan \left (d x +c \right )^{2}}-\frac {i B \ln \left (\tan \left (d x +c \right )\right )}{a d}-\frac {2 A \ln \left (\tan \left (d x +c \right )\right )}{d a}+\frac {i A}{a d \tan \left (d x +c \right )}-\frac {B}{a d \tan \left (d x +c \right )}+\frac {i A}{2 d a \left (\tan \left (d x +c \right )-i\right )}-\frac {B}{2 d a \left (\tan \left (d x +c \right )-i\right )}+\frac {7 \ln \left (\tan \left (d x +c \right )-i\right ) A}{4 d a}+\frac {5 i \ln \left (\tan \left (d x +c \right )-i\right ) B}{4 d a} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.51, size = 153, normalized size = 1.17 \[ -\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {3\,A}{2\,a}+\frac {B\,3{}\mathrm {i}}{2\,a}\right )+\frac {A}{2\,a}-\mathrm {tan}\left (c+d\,x\right )\,\left (-\frac {B}{a}+\frac {A\,1{}\mathrm {i}}{2\,a}\right )}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^3\,1{}\mathrm {i}+{\mathrm {tan}\left (c+d\,x\right )}^2\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (2\,A+B\,1{}\mathrm {i}\right )}{a\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )}{4\,a\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (7\,A+B\,5{}\mathrm {i}\right )}{4\,a\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 1.33, size = 201, normalized size = 1.53 \[ \frac {2 A - 2 i B e^{2 i c} e^{2 i d x} + 2 i B}{a d e^{4 i c} e^{4 i d x} - 2 a d e^{2 i c} e^{2 i d x} + a d} + \begin {cases} - \frac {\left (A + i B\right ) e^{- 2 i c} e^{- 2 i d x}}{4 a d} & \text {for}\: 4 a d e^{2 i c} \neq 0 \\x \left (- \frac {7 i A - 5 B}{2 a} + \frac {\left (7 i A e^{2 i c} + i A - 5 B e^{2 i c} - B\right ) e^{- 2 i c}}{2 a}\right ) & \text {otherwise} \end {cases} - \frac {x \left (- 7 i A + 5 B\right )}{2 a} - \frac {\left (2 A + i B\right ) \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{a d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________